package cn.edu.ctbu.kcsj.service;

import cn.edu.ctbu.kcsj.domain.Student;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public interface StudentService {

    List<Student> findAll();

    /**
     * 只分页的查询
     * @param pageable
     * @return
     */
    Page<Student> findAll(Pageable pageable);

    /**
     * 分页，带过滤的查询
     * @param student
     * @param pageable
     * @return
     */
    Page<Student>findAll(Example<Student> student,Pageable pageable);
    /**
     * 按名字进行查询，like
     *
     * @param name 字符串
     * @return
     */
    List<Student> findBySnameLike(String name);
    /**
     * 按学号和密码查询
     *
     * @param sno
     * @param password
     * @return
     */
    List<Student> findBySnoAndPassword(Integer sno, String password);
    Student insert(Student student);
    Student update(Student student);
    void delete(Student student);
    void delete(Integer id);
    Student getBySno(Integer sno);

    /**
     * 验证用户名和密码，通过返回读取学生
     * @param sno
     * @param password
     */
    Student validateSnoAndPassword(Integer sno,String password) throws Exception;
}
